package ssm.service.serviceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ssm.dao.UserStudentDao;
import ssm.pojo.UserStudent;
import ssm.service.UserStudentService;

import java.util.List;

@Service
public class UserStudentServiceImpl implements UserStudentService {

    @Autowired
    private UserStudentDao userStudentDao;

    @Override
    public Boolean insertStudent(UserStudent userstudent) {
        System.out.println("执行service层");
        boolean a = userStudentDao.insert(userstudent)>0 ? true:false;
        System.out.println("执行service完成");
        return a;
    }

    @Override
    public Boolean deleteStudent(Integer studentId) {
        return userStudentDao.deleteByStudentId(studentId)>0 ? true : false;
    }

    @Override
    public Boolean updateStudent(UserStudent userstudent) {
        return userStudentDao.updateSudent(userstudent)>0 ? true:false;
    }

    @Override
    public List<UserStudent> selectStudentAll() {
        List<UserStudent> list = userStudentDao.selectStudentAll();
        return list;
    }

    @Override
    public UserStudent selectStudentOne(Integer studentId) {
        UserStudent userstudent = userStudentDao.selectStudentById(studentId);
        return userstudent;
    }
}
